#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main() {
    int n = 0;
    scanf("%d", &n);
    int s_ort[n];

    int boo = 0;
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &s_ort[i]);
    }

    if (s_ort[0] < s_ort[1])
    {
        boo = 1;
    }
    else if (s_ort[0] > s_ort[1])
    {
        boo = 2;
    }

    int j = 0;
    for (j = 2; j < n; j++)
    {
        if (!((boo == 1 && s_ort[j] > s_ort[j - 1]) || (boo == 2 && s_ort[j] < s_ort[j - 1]) || (boo == 0 && s_ort[j] == s_ort[j - 1])))
        {
            break;
        }
    }

    if (j == n)
    {
        printf("sorted\n");
    }
    else {
        printf("unsorted\n");
    }




    return 0;
}